package com.probox.customer.api.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.probox.common.core.annotation.Excel;
import com.probox.common.core.utils.StringUtils;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * 客户收藏记录对象 customer_collect
 *
 * @author zsy
 * @date 2021-06-26
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("customer_collect")
public class CustomerCollect implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * $column.columnComment
     */
    //默认主键自增
    @TableId(value = "COLLECT_UID", type = IdType.AUTO)
    private Long collectUid;
    /**
     * 平台ID
     */
    @Excel(name = "平台ID")
    private Long platformUid;
    /**
     * 收藏对象类型（store商铺/good商品）
     */
    @Excel(name = "收藏对象类型", readConverterExp = "s=tore商铺/good商品")
    private String objType;
    /**
     * 收藏对象id
     */
    @Excel(name = "收藏对象id")
    private Long objUid;
    /**
     * 收藏对象名称
     */
    @Excel(name = "收藏对象名称")
    private String objName;
    /**
     * 收藏对象图片
     */
    @Excel(name = "收藏对象图片")
    private String objImgUrl;
    /**
     * 收藏状态（1已收藏0取消收藏
     */
    @Excel(name = "收藏状态", readConverterExp = "收藏状态（1已收藏0取消收藏")
    private String collectStatus;
    /**
     * 收藏时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "收藏时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date collectTime;
    /**
     * 收藏者ID
     */
    @Excel(name = "收藏者ID")
    private Long customerUid;
    /**
     * 收藏人
     */
    @Excel(name = "收藏人")
    private String customerName;
    /**
     * 收藏人昵称
     */
    @Excel(name = "收藏人昵称")
    private String customerNickName;
    /**
     * 收藏人头像
     */
    @Excel(name = "收藏人头像")
    private String customerHeadUrl;
    /**
     * 取消收藏时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "取消收藏时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public String getObjImgUrlStr(){
        if (!StringUtils.isEmpty(this.objImgUrl)){
            String objImgUrl = this.objImgUrl;
            String[] split = objImgUrl.split(",");
            return split[0];
        }
        return null;
    }

    private String productNo;

    private String lunwenType;

    private Integer numbers;

    private String showFile;

    @TableField(exist = false)
    private String startDate;

    @TableField(exist = false)
    private String endDate;

    @TableField(exist = false)
    private String[] createTimeArray;

}
